﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ISS.IR.RRNMS.Library.DataAccess;

namespace ISS.IR.RRNMS.Library
{
    public struct Item
    {
        public int Id { get; set; }
        public string Value { get; set; }
        public Guid GUID { get; set; }

        public override string ToString()
        {
            return Value;
        }
    }

    public struct EntityField
    {
        public int FieldId { get; set; }
        public string FieldDisplayName { get; set; }
        public string FieldSchemaName { get; set; }
        public Item Entity { get; set; }
        public Item Type { get; set; }
        public Item Category { get; set; }

        public override string ToString()
        {
            return FieldDisplayName;
        }
    }

    public struct Slot
    {
        public Guid SlotId { get; set; }
        public int FromHour { get; set; }
        public int FromMinutes { get; set; }
        public int ToMinutes { get; set; }
        public int ToHours { get; set; }

        public override string ToString()
        {
            return "من" + FromHour + " : " + FromMinutes + "الى" + ToHours + " : " + ToMinutes;
        }
    }

    public struct QueryCondition
    {
        public int FieldId { get; set; }
        public string FieldDisplayName { get; set; }
        public string FieldSchemaName { get; set; }
        public Item FieldType { get; set; }

        public string OperatorDisplayName { get; set; }
        public string OperatorSchemaName { get; set; }

        public string Value { get; set; }
        public int LookupValue { get; set; }
        public Guid LookupGuidValue { get; set; }

        public override string ToString()
        {
            return FieldSchemaName;
            //if (LookupValue != 0) // lookup
            //    return FieldSchemaName + " " + OperatorSchemaName + " " + LookupValue;

            //else if (!OperatorSchemaName.Contains("IR_VALUE"))
            //    return FieldSchemaName + " " + OperatorSchemaName + " " + Value;
            //else
            //{
            //    switch (OperatorSchemaName)
            //    {
            //        case "=IR_VALUE":
            //            OperatorSchemaName = " = '" + Value + "'";
            //            break;

            //        case "LIKE IR_VALUE%":
            //            OperatorSchemaName = " LIKE '" + Value + "%'";
            //            break;

            //        case "LIKE %IR_VALUE":
            //            OperatorSchemaName = " LIKE '%" + Value + "'";
            //            break;

            //        case "LIKE %IR_VALUE%":
            //            OperatorSchemaName = " LIKE '%" + Value + "%'";
            //            break;
            //    }
            //    return FieldSchemaName + " " + OperatorSchemaName;
            //}
        }
    }

    public struct Operator
    {
        public int TypeId { get; set; }
        public string OperatorDisplayName { get; set; }
        public string OperatorSchemaName { get; set; }

        public override string ToString()
        {
            return OperatorDisplayName;
        }
    }
}
